package com.wt.admin.service.mail.impl;

import cn.hutool.core.util.CharsetUtil;
import com.wt.admin.service.mail.MailService;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class MailServiceImpl implements MailService {
    @Override
    public void send() {
        JavaMailSenderImpl config = config();
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject("");
        message.setFrom("nickname<mail>");
        message.setTo("","");
        message.setSentDate(new Date());
        message.setText("");
        config.send(message);
    }

    private JavaMailSenderImpl config(){
        JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
        javaMailSender.setDefaultEncoding(CharsetUtil.UTF_8);
        javaMailSender.setHost("");
        javaMailSender.setPort(2);
        javaMailSender.setUsername("");
        javaMailSender.setPassword("");
        return javaMailSender;
    }

}
